package com.order.provider.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "配置测试")
@RestController
@RefreshScope//在控制器类加入@RefreshScope注解使当前类下的配置支持Nacos的动态刷新功能
//你可以通过配置 spring.cloud.nacos.config.refresh.enabled=false 来关闭动态刷新
public class ConfigController {

    @Value("${test.config}")
    private String testConfig;

    @GetMapping(value = "/provider/config")
    public String getConfig() {
        return "服务提供者读取配置信息：" + testConfig;
    }
}
